package com.coders.android;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.coders.android.taxi.LoginActivity;
import com.coders.android.user.UserMapActivity;

public class MainActivity extends ListActivity {

	private Intent intent = null;
	private String options [] = { 
			"Taxi driver", 
			"User", 
			"About",
			"Exit" 
			};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setListAdapter( new ArrayAdapter<String>( MainActivity.this , android.R.layout.simple_list_item_1, options ) );
	}	
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		
		switch( position ) {
			
			case 0: intent = new Intent( MainActivity.this, LoginActivity.class ); break;
			case 1: intent = new Intent( MainActivity.this, UserMapActivity.class ); break;
			case 2: intent = new Intent( MainActivity.this, AboutActivity.class ); break;
			case 3: System.exit( 0 ); break;
		}
		startActivity( intent );
	}
}
